# auto load
extends Node



var _player: Player
var _cursor: Cursor


# 绑定全局快捷键
func _input(event: InputEvent) -> void:
    if event.is_action_pressed("full_screen"):
        var mode := DisplayServer.window_get_mode()
        mode = DisplayServer.WINDOW_MODE_WINDOWED if mode == DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN else DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN
        DisplayServer.window_set_mode(mode)


## 在选择角色确定后，调用该函数
func init_player(player: Player) -> void:
    _player = player


func init_cursor(curosr: Cursor) -> void:
    _cursor = curosr


func get_player() -> Player:
    if _player == null:
        printerr("当前player为null，请先调用init_player()初始化player")
        return null
    return _player


func get_cursor() -> Cursor:
    if _cursor == null:
        printerr("当前curosr为null，请先调用init_cursor()初始化curosr")
        return null
    return _cursor
